package com.dlc.shop.systemtest.api.common;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dlc.shop.bean.model.AttachFile;
import com.dlc.shop.common.util.Json;
import com.dlc.shop.systemtest.constants.Constant;
import com.dlc.shop.systemtest.util.HttpUtil;

import java.util.List;

/**
 * @author lpj
 */
public class FileApi {

    /**
     * 分页获取文件资源
     */
    public static List<AttachFile> attachFile(Integer attachFileGroupId, Integer type) {
        String url = Constant.SHOP_URL + "/admin/file/attachFilePage?attachFileGroupId=" + attachFileGroupId + "&type=" + type;
        return JSON.parseArray(JSON.toJSONString(Json.parseObject(JSON.toJSONString(HttpUtil.get(url,Page.class)), Page.class).getRecords()), AttachFile.class);
    }

}
